<template>
	<view class="pages">
		<view class="List">
			<view class="my" v-for="(item,index) in dataList" :key="index">
				<view class="left">
					<view
						style="display: flex;justify-content: space-between;margin-bottom: 3vw;border-bottom: 1rpx solid silver;">
						<view class="showName" style="font-size: 40rpx;margin-bottom: 20rpx;font-weight: 700;">
							{{ item.formUser }}
						</view>
						<view style="margin-right: 2vw;" v-if="item.shopStatus == 1">
							已取消
						</view>
						<view style="margin-right: 2vw;" v-else-if="item.shopStatus == 2">
							已完成
						</view>
						<view style="margin-right: 2vw;" v-else>
							已下单
						</view>
					</view>
					<view style="display: flex;justify-content: space-between;">
						<view>
							<image :src="item.images" style="width: 20vw;height: 20vw;margin-left: 2vw;" mode="">
							</image>
							<view class="showPhone">
								{{ item.shopName }}
							</view>
						</view>
						<view>
							<view class="show" style="width: 300rpx;display: flex;padding: 0 0 0.2vh 0;">
								<!-- x{{ item.shopNums }} -->
								<span style="margin-left: auto;">x1000</span>
							</view>
							<view class="show" style="width: 300rpx;display: flex;padding: 0 0 0.2vh 0;">
								<!-- 单价¥{{ item.shopPrice }},实付¥{{ item.shopTotalPrice }} -->
								<span
									style="margin-left: auto;">单价¥{{ item.shopPrice }},实付¥{{ item.shopTotalPrice }}</span>
							</view>
							<view class="show" style="width: 300rpx;display: flex;margin-top: 0.5vh;"
								v-if="item.shopStatus!=1">
								<button @click="one(item.shopWorkNums)"
									style="margin-right:0.5vw;font-size: 30rpx;">取消订单</button>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		allShopPerSonList,
		guard,
		cancelPersonShop
	} from "@/ww.js"
	import {
		toast
	} from "@/common.js"
	export default {
		data() {
			return {
				dataList: []
			};
		},
		onLoad() {
			guard('../../login/login')
			this.ShopPerSonList()
		},
		methods: {
			one(n) {
				cancelPersonShop({
					shopWorkNums: n
				}).then(res => {
					if (res.code == 200) {
						toast('取消成功')
						this.ShopPerSonList()
					}
				})
			},
			ShopPerSonList() {
				allShopPerSonList({
					username: uni.getStorageSync("userInfo").username
				}).then(res => {
					this.dataList = res.data.reverse()
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.List {
		width: 100vw;
		overflow: auto;

		.my {
			width: 80vw;
			margin: 1.5vh auto;
			padding: 3vw 0;
			background: #fff;
			border-radius: 15rpx;
			display: flex;
			box-shadow: 0px 5px 10px #888888;

			.left {
				width: 100%;

				.showName,
				.showPhone,
				.show {
					font-size: 28rpx;
					line-height: 32rpx;
					margin-left: 2vw;
					margin-right: 2vw;
				}
			}

			.right {
				width: 30%;
				display: flex;
				align-items: center;
				justify-content: center;
			}
		}
	}


	/////
	.pages {
		width: 100%;
		height: 100vh;
		position: relative;
	}

	.Add {
		width: 100%;
		height: 10vh;
		position: absolute;
		bottom: 0;
		left: 0;
		background-color: #fff;
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.Add>view {
		display: flex;
		align-items: center;
	}
</style>